//
//  TabTitleCell.m
//  LBNestScrollTableView
//
//  Created by liubo on 2022/10/15.
//

#import "TabTitleCell.h"
#import <Masonry/Masonry.h>

@interface TabTitleCell ()

@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation TabTitleCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setUpUI];
        [self setUpContraints];
    }
    return self;
}

- (void)setUpUI
{
    [self.contentView addSubview:self.titleLabel];
}

- (void)setUpContraints
{
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.centerX.mas_equalTo(0);
    }];
}

- (void)setIndexPath:(NSIndexPath *)indexPath
{
    NSString *title = [NSString stringWithFormat:@"标题%ld",indexPath.item];
    self.titleLabel.text = title;
}

#pragma mark - lazy load

- (UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:20];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}

@end
